#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
    int n = 0, m = 0, max = 0, min = 100;
    scanf("%d", &n);
    while (scanf("%d", &m) != EOF) {
        if (m > max) {
            max = m;
        }if (m < min) {
            min = m;
        }
    }
    printf("%d", max - min);
    return 0;
}